package com.funny.config;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * @author Ming
 * @description
 * @fileSimpleName HeaderOriginParser
 * @fileName com.funny.config.HeaderOriginParser
 * @date 2024年07月03日 18:09
 */
@Component
public class HeaderOriginParser implements RequestOriginParser {


    @Override
    public String parseOrigin(HttpServletRequest httpServletRequest) {
        String origin = httpServletRequest.getHeader("Origin");
        if (StringUtils.isEmpty(origin)) {
            return "blank";
        }
        return origin;
    }
}
